When humanity has gone totally wayward and the world is to be flooded and its life is to be terminated, that looks like the end, but it is not the end. There is the possibility of new life when you would have thought there was no such possibility. First, God reflects on what the story has taught us so far. Once more it speaks as though God has learned a thing or two through what has happened. Although this might again be just a metaphorical way of speaking, Genesis does describe God discovering things
Page 110